<?php 
include_once 'admin-functions.php';

$user = $_POST['user'];
$password = $_POST['pass'];
$hash = md5($password);

function proceed($user, $rank) {
	// Start our PHP Session
	session_start();
	$_SESSION['account_name'] = $user;
	$_SESSION['account_rank'] = $rank;
	$_SESSION['logged_in']  = 1;
	header('Location: page.php?p=main');
}

$content = parse_ini_file($blog_users, true);

if (array_key_exists($user, $content) && $content[$user]['md5'] == $hash) {
		proceed($user, $content[$user]['type']);
	}
	
else {
	header('Location: login.php');
}

?>
